# Main场景脚本（控制生成）
extends Node2D

@export var mob_scene : PackedScene  # 通过编辑器拖入怪物场景
@onready var player = $Player  # 假设玩家节点名为Player

func _ready():
	$MobTimer.start()

func _on_mob_timer_timeout():
	var new_mob = mob_scene.instantiate()
	var spawn_path = $Path2D/PathFollow2D
	
	# 设置随机生成点
	spawn_path.progress_ratio = randf()
	var spawn_position = spawn_path.global_position
	
	# 初始化怪物参数
	new_mob.initialize(spawn_position, player)
	add_child(new_mob)
